package selenium;

import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import pages.OnlineOrderPage;


public class NegativeOnlineOrder extends TestConditions
{

    @DataProvider(name = "newClientData")
    public Object[][] provideData()
    {
        return new Object[][]
                {
                        new Object[] {"Vasia", "Киев","0509998877","123@i.com"},
                                     {"Vasia", "", "000", "123@i.com"},
                                     {"Vova", "", "0509998877","123"},
                                     {"Delete * from MyAdmin", "", "0509998877","123@i.com"},
                };
    }

   @Test
   public void proceedToCheckoutPage()
   {
       OnlineOrderPage onlineOrderPage=new OnlineOrderPage(driver);
       onlineOrderPage.openOnlineOrderPage();
       onlineOrderPage.searchProduct();
       onlineOrderPage.onlineOrder();
   }
    @Test (dependsOnMethods = "proceedToCheckoutPage", dataProvider = "newClientData")
    public void checkNewClientData(String name, String city, String phone, String mail)
    {
       OnlineOrderPage onlineOrderPage=new OnlineOrderPage(driver);
       onlineOrderPage.checkNewClientData(name, city, phone, mail);

       Assert.assertTrue(onlineOrderPage.isNewClientDataCorrect());
    }
}
